/*
 * @Description: api test
 * @version: 0.0.1
 * @Author: 小妖怪
 * @Date: 2020-06-22 09:42:27
 * @LastEditors: Mr.小妖怪
 * @LastEditTime: 2021-10-11 10:35:04
 * @FilePath: \gulp\gulpfile.js
 */

const { src, dest, series, symlink, lastRun, watch } = require('gulp')
const del = require('delete')

function clean(cb) {
  // del(['output/'])
  cb()
}

function test001() {
  return src('src/*.js', {
    read: true,
    since: 5000,
    sourcemaps: true,
  })
    .pipe(dest('output/', {
      sourcemaps: '.',
      append: true
    }))
}

exports.test001 = series(clean, test001)

// symlink

function linkTask() {
  return src('src/*.js')
    .pipe(symlink('output/'))
}

exports.linkTask = linkTask

// lastRun

const imagemin = require('gulp-imagemin');

function imageTask() {
  return src('src/*.css', { since: lastRun(imageTask) })
    .pipe(imagemin())
    .pipe(dest('output/css/'))
}

defaults.imageTask = imageTask

const Vinyl = require('vinyl')

